<template>
	<view>
		<!-- <button type="primary" @tap="hf('index')">测试</button>
		<button type="primary" @tap="cdkdfdsft" ref="xczxcsdftr" class="xcxdgtretyty">半屏打开</button>

	
		
		</view> -->
	<view  class="zxczxtretyty">
	<image src="https://duxinggj-1251133427.cos.ap-guangzhou.myqcloud.com/yx/yuyue/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20240718135221.jpg" class="w100 h100" mode="aspectFill"></image> 
	<view class="xczxcrtecfgr vertical-center" v-if="kmxdrt<=1">
		<view class="kxzczxtretret">
			<view class="dcvxytrytr">
				玛雅圣殿
			</view>
			<view class="mt20 dfdsgrtryytr tlddq">
				欢迎开启玛雅文化之旅，这是一款疗愈型产品。
				
				 
				
				<view class="mt20">
					玛雅文化是美洲的古印第安人在与大自然的长期合作中总结出的一套宝贵经验。其中，玛雅图腾是玛雅文化的重要组成部分，通常以动物、植物或自然现象为原型。
					
				</view>
				 
				
				<view class="mt20">
					通过在“玛雅圣殿”中的主题解读探索，了解自己的玛雅图腾，以及在日常生活中的有趣的表现形式。你会充分的体验玛雅文化如何支撑着你的内在探索！
					
				</view>
				
				<view class="tr ls mt20" @tap="hf(navigationPath)">
					欢迎进入
				</view>
				 
			</view>
		</view>
	</view>
</view>
<!-- <view class="mt100">
	<textarea v-model="kxcdsfds"></textarea>
</view> -->

		<view class="jjhxzczdff display-flex czbj" v-if="jkxcert">
			<view class="xzczxereswt   flex-1">
				<view class="">
					<image src="https://duxinggj-1251133427.cos.ap-guangzhou.myqcloud.com/v1/img/544.gif" class="w100"
						mode="widthFix"></image>
				</view>

			</view>
			<view class="xzczxertet">
				<view class="pr pd">
					<button type="primary" class="cxvtrexrt" @tap="cdkdfdsft">立即充值</button>

				</view>
			</view>
		</view>


		<!-- 	 -->
	</view>
</template>
<script lang="ts" setup>
	import { onLoad, onShareAppMessage,onShow } from "@dcloudio/uni-app"
	import { ref } from "vue"
	import { hf, dxrequest, callBack } from "@/util/index.js"
	const xczxcsdftr = ref()
	const jkxcert = ref(false)
	const jxdfr = ref()
	const miniapp_charge_path =ref()
	const fromAgentId= ref()
	const kxcdsfds =ref()
	let navigationPath = ref('wbview')
	const shareUserId = ref()
	 const urlToObject = (url) => {
		var urlObject = {};
		if (/\?/.test(url)) {
			var urlString = url.substring(url.indexOf("?") + 1);
			var urlArray = urlString.split("&");
			for (var i = 0, len = urlArray.length; i < len; i++) {
				var urlItem = urlArray[i];
				var item = urlItem.split("=");
				urlObject[item[0]] = item[1];
			}
			return urlObject;
		}
	};
	const kmxdrt = ref(0)
	
	onLoad(async(data)=>{
		console.log(data)
		console.log(9999)
		kxcdsfds.value= decodeURIComponent(data.q)
		try{//链接的方式
			const onloadParams = urlToObject(kxcdsfds.value)
			shareUserId.value=onloadParams.shareUserId
			const app_code = onloadParams?.app_code
			if (app_code) {
				uni.setStorageSync('app_code', app_code)
			}
			if (onloadParams?.shareUserId) {
				uni.setStorageSync('fromShareUserId', shareUserId.value)
			}
		}catch(e){
			
		}
		// 普通传值的方式
		if(data.shareUserId){
			shareUserId.value = data.shareUserId
			uni.setStorageSync('fromShareUserId', data.shareUserId)
		}
		if(data.app_code){
			uni.setStorageSync('app_code', data.app_code)
		}
		uni.setStorageSync("shareUserId",shareUserId.value)
	
	
	
		
		if (kxcdsfds.value != 'undefined' && kxcdsfds.value.indexOf('?') > 0) {
			const query = kxcdsfds.value.split('?')[1]
			console.log('query:', query)
			
			if (query) {
				navigationPath.value = navigationPath.value + '?' + query
				console.log(navigationPath.value)
				uni.setStorageSync('navigationPath', navigationPath.value)
			}
		
		}
		
	
	})
	onShow(()=>{
			kmxdrt.value++
		if(!jkxcert.value&&kmxdrt.value>1){
			setTimeout(a=>{
				hf(navigationPath.value)
			},500)
		}
	})
	const cdkdfdsft = () => {
		uni.openEmbeddedMiniProgram({
			appId: 'wx59e8d96758d4b05d',
			path: miniapp_charge_path.value,
			extraData: {
				fromAgentId:fromAgentId.value
			},
			success(res) {
				jkxcert.value = false
				hf('wbview')
			}
		})
	} 
	// onLoad(()=>{
	// 	setTimeout(a=>{

	// 	},3000)
	// })

	uni.$on('citycallback', (res) => {
		console.log(res)
		if (res.banping == 3) {
			jkxcert.value = true
			miniapp_charge_path.value = res.detail.data[0].miniapp_charge_path
			fromAgentId.value = res.detail.data[0].fromAgentId
		}
		if(res.banping == 4){
			kmxdrt.value = 0
			uni.reLaunch({
				url: '/pages/renwu/list?token='+res.token
			});
		}

	})

	onShareAppMessage(() => {
		return {
			title: '莘古灵境	',
			path: '/pages/index/index'
		}
	})
</script>

<style scoped>
	
</style>
